package com.uit.httt04.duongvanlam.facedetection.xml;

import java.util.ArrayList;
import java.util.List;

public class AlgorithmXML extends Object
{
	private String algorithmName;
	private long timestampStarting;
	private long trainingLengthByMilliseconds;
	private String trainingFolderPath;
	private int imageHeight;
	private int imageWidth;
	private int totalAmountOfImages;
	private int totalAmountOfFaces;
	private List<ObjectXML> objects;
	private int eigenvectorMaxN;
	private char matrixDataSplitBy;
	private MatrixXML eigenvectorMatrix;
	private MatrixXML eigenvalueMatrix;
	private List<ProjectedObjectXML> projectedObjects;
	private List<String> allowedExt;
	private List<IDToNameXML> autoID;

	public String getAlgorithmName()
	{
		return algorithmName;
	}

	public void setAlgorithmName(String algorithmName)
	{
		this.algorithmName = algorithmName;
	}

	public long getTimestampStarting()
	{
		return timestampStarting;
	}

	public void setTimestampStarting(long timestampStarting)
	{
		this.timestampStarting = timestampStarting;
	}

	public long getTrainingLengthByMilliseconds()
	{
		return trainingLengthByMilliseconds;
	}

	public void setTrainingLengthByMilliseconds(long trainingLengthByMilliseconds)
	{
		this.trainingLengthByMilliseconds = trainingLengthByMilliseconds;
	}

	public String getTrainingFolderPath()
	{
		return trainingFolderPath;
	}

	public void setTrainingFolderPath(String trainingFolder)
	{
		this.trainingFolderPath = trainingFolder;
	}

	public int getImageHeight()
	{
		return imageHeight;
	}

	public void setImageHeight(int imageHeight)
	{
		this.imageHeight = imageHeight;
	}

	public int getImageWidth()
	{
		return imageWidth;
	}

	public void setImageWidth(int imageWidth)
	{
		this.imageWidth = imageWidth;
	}

	public int getTotalAmountOfImages()
	{
		return totalAmountOfImages;
	}

	public void setTotalAmountOfImages(int totalAmountOfImages)
	{
		this.totalAmountOfImages = totalAmountOfImages;
	}

	public int getTotalAmountOfFaces()
	{
		return totalAmountOfFaces;
	}

	public void setTotalAmountOfFaces(int totalAmountOfFaces)
	{
		this.totalAmountOfFaces = totalAmountOfFaces;
	}

	public List<ObjectXML> getObjects()
	{
		return objects;
	}

	public void setObjects(List<ObjectXML> objects)
	{
		this.objects = objects;
	}

	public int getEigenvectorMaxN()
	{
		return eigenvectorMaxN;
	}

	public void setEigenvectorMaxN(int eigenvectorMaxN)
	{
		this.eigenvectorMaxN = eigenvectorMaxN;
	}

	public char getMatrixDataSplitBy()
	{
		return matrixDataSplitBy;
	}

	public void setMatrixDataSplitBy(char matrixDataSplitBy)
	{
		this.matrixDataSplitBy = matrixDataSplitBy;
	}

	public MatrixXML getEigenvectorMatrix()
	{
		return eigenvectorMatrix;
	}

	public void setEigenvectorMatrix(MatrixXML eigenvectorMatrix)
	{
		this.eigenvectorMatrix = eigenvectorMatrix;
	}

	public List<ProjectedObjectXML> getProjectedObjects()
	{
		return projectedObjects;
	}

	public void setProjectedObjects(List<ProjectedObjectXML> projectedObjects)
	{
		this.projectedObjects = projectedObjects;
	}

	public List<String> getAllowedExt()
	{
		return allowedExt;
	}

	public void setAllowedExt(List<String> AllowedExt)
	{
		this.allowedExt = AllowedExt;
	}

	public List<IDToNameXML> getAutoID()
	{
		return autoID;
	}

	public void setAutoID(List<IDToNameXML> AutoID)
	{
		this.autoID = AutoID;
	}

	public MatrixXML getEigenvalueMatrix()
	{
		return eigenvalueMatrix;
	}

	public void setEigenvalueMatrix(MatrixXML eigenvalueMatrix)
	{
		this.eigenvalueMatrix = eigenvalueMatrix;
	}

	public AlgorithmXML Copy()
	{
		AlgorithmXML algorithmXML = new AlgorithmXML();

		algorithmXML.setAlgorithmName(this.getAlgorithmName());
		algorithmXML.setTimestampStarting(this.getTimestampStarting());
		algorithmXML.setTrainingLengthByMilliseconds(this.getTrainingLengthByMilliseconds());
		algorithmXML.setTrainingFolderPath(this.getTrainingFolderPath());
		algorithmXML.setImageHeight(this.getImageHeight());
		algorithmXML.setImageWidth(this.getImageWidth());
		algorithmXML.setTotalAmountOfImages(this.getTotalAmountOfImages());
		algorithmXML.setTotalAmountOfFaces(this.getTotalAmountOfFaces());
		algorithmXML.setEigenvectorMaxN(this.getEigenvectorMaxN());
		algorithmXML.setMatrixDataSplitBy(this.getMatrixDataSplitBy());

		MatrixXML eigenvectorMatrix = new MatrixXML();
		eigenvectorMatrix.setData(this.getEigenvectorMatrix().getData());
		eigenvectorMatrix.setHeight(this.getEigenvectorMatrix().getHeight());
		eigenvectorMatrix.setWidth(this.getEigenvectorMatrix().getWidth());
		algorithmXML.setEigenvectorMatrix(eigenvectorMatrix);

		MatrixXML eigenvalueMatrix = new MatrixXML();
		eigenvalueMatrix.setData(this.getEigenvalueMatrix().getData());
		eigenvalueMatrix.setHeight(this.getEigenvalueMatrix().getHeight());
		eigenvalueMatrix.setWidth(this.getEigenvalueMatrix().getWidth());
		algorithmXML.setEigenvalueMatrix(eigenvalueMatrix);

		List<ObjectXML> listObject = new ArrayList<ObjectXML>();
		for (int i = 0; i < this.getObjects().size(); i++)
		{
			ObjectXML temp = new ObjectXML();
			temp.setImagePath(this.getObjects().get(i).getImagePath());
			temp.setPersonName(this.getObjects().get(i).getPersonName());
			listObject.add(temp);
		}
		algorithmXML.setObjects(listObject);

		List<ProjectedObjectXML> listProjectedObject = new ArrayList<ProjectedObjectXML>();
		for (int i = 0; i < this.getProjectedObjects().size(); i++)
		{
			ProjectedObjectXML temp = new ProjectedObjectXML();
			temp.setImagePath(this.getProjectedObjects().get(i).getImagePath());

			MatrixXML matrixXMLTemp = new MatrixXML();
			matrixXMLTemp.setData(this.getProjectedObjects().get(i).getMatrix().getData());
			matrixXMLTemp.setHeight(this.getProjectedObjects().get(i).getMatrix().getHeight());
			matrixXMLTemp.setWidth(this.getProjectedObjects().get(i).getMatrix().getWidth());

			temp.setMatrix(matrixXMLTemp);
			temp.setPersonName(this.getProjectedObjects().get(i).getPersonName());
			listProjectedObject.add(temp);
		}
		algorithmXML.setProjectedObjects(listProjectedObject);

		List<String> allowedExt = new ArrayList<String>();
		for (int i = 0; i < this.getAllowedExt().size(); i++)
		{
			allowedExt.add(this.getAllowedExt().get(i));
		}
		algorithmXML.setAllowedExt(allowedExt);

		List<IDToNameXML> autoID = new ArrayList<IDToNameXML>();
		for (int i = 0; i < this.getAutoID().size(); i++)
		{
			autoID.add(new IDToNameXML(this.getAutoID().get(i).getID(), this.getAutoID().get(i).getName()));
		}
		algorithmXML.setAutoID(autoID);

		return algorithmXML;
	}

	@Override
	public void finalize() throws Throwable
	{
		super.finalize();
	}
	//
}
